/*
	File:				Entity.h
	Course:		SGP 1208
	Author:		Kori Po
	Purpose:	Base Class for all in-game objects
*/

#pragma once

#include "IEntity.h"

// Enumeration of object types
enum ObjectType	{ OBJ_BASE, OBJ_PLAYER, OBJ_ENEMY, OBJ_ITEM, OBJ_ABILITY, OBJ_LAYER, OBJ_TILE, OBJ_CAMERA, TOTAL_COUNT };


class CEntity :	public IEntity
{
public:
	// Def Con && Decon
	CEntity(void);
	virtual ~CEntity(void);

	////////////////////////
	// IEntity Interface:
	////////////////////////
	
	// Primary Running Functions
	virtual void Update( float fElapsedTime );
	virtual void Render( void );

	// Secondary Interface Functions
	virtual int  GetType( void ) const	{	return m_nType;	}
	virtual RECT GetRect( void ) const;
	virtual bool CheckCollision( IEntity* pOther );
	
	// Reference Opts
	virtual void AddRef( void );
	virtual void Release( void );

	// Accessors:
	int		GetImageID			( void ) const	{	return m_nImageID;		}
	int		GetWidth					( void ) const	{	return m_nWidth;			}
	int		GetHeight				( void ) const	{	return m_nHeight;			}
	float	GetX							( void ) const	{	return m_fX;						}
	float	GetY							( void ) const	{	return m_fY;						}
	float	GetVelX					( void ) const	{	return m_fVelX;				}
	float	GetVelY					( void ) const	{	return m_fVelY;				}
	float	GetRotation			( void ) const	{	return m_fRotation;		}
	bool	GetFacing				( void ) const	{	return m_bFacing;			}
	RECT	GetSourceRect		( void ) const	{	return m_SourceRect;	}
	RECT	GetCollsionRect		( void ) const	{	return m_CollsionRect; }

	// Mutators:
	void	SetImageID				( int	pID				)		{	m_nImageID		= pID;				}
	void	SetWidth					( int	pWidth		)		{	m_nWidth				= pWidth;		}
	void	SetHeight					( int	pHeight		)		{	m_nHeight			= pHeight;	}
	void	SetX							( float	pX			)		{	m_fX						= pX;				}
	void	SetY							( float	pY			)		{	m_fY						= pY;				}
	void	SetVelX						( float	pVelX		)		{	m_fVelX					= pVelX;			}
	void	SetVelY						( float	pVelY		)		{	m_fVelY					= pVelY;		}
	void	SetRotation				( float	r				)		{	m_fRotation		= r;					}
	void	SetFacing					( bool pFace	)		{	m_bFacing			= pFace;		}
	void	SetType						( int pType		)		{	m_nType				= pType;		}
	void	SetSourceRect		( RECT pRect )		{	m_SourceRect	= pRect;		}
	void	SetCollsionRect		( RECT pRect )		{	m_CollsionRect	= pRect;		}

protected:
	// token type
	int			m_nType;

private:
	// image
	int		m_nImageID;

	// size
	int		m_nWidth;
	int		m_nHeight;

	// position
	float	m_fX;
	float	m_fY;

	// velocity
	float	m_fVelX;
	float	m_fVelY;

	// rotation - in radians!
	float		m_fRotation;

	// reference count
	int		m_nRefCount;

	//Facing
	bool	m_bFacing;

	// Rect
	RECT m_SourceRect;
	RECT m_CollsionRect;
};

